#include <stdio.h>
#include <unistd.h>
#include <time.h>
#include <stdlib.h>

#include "process.h"
const int base = 2;
double total = 2048.0;
double once = 0.1;

void download()
{
  double current = 0.0;
  while (current < total)
  {
    // 模拟下载行为
    int r = rand() % base + 1;
    double speed = r * once;
    current += speed;
    if (current >= total)
      current = total;
    usleep(10000);

    Process(total, current);
  }
  printf("\n");
}

int main()
{
  srand(time(NULL));
  download();
  //下面是linux下的修改
  printf("aaaaaaaaaa");
  printf("aaaaaaaaaa");
  printf("aaaaaaaaaa");
  printf("aaaaaaaaaa");
  printf("aaaaaaaaaa");
  printf("aaaaaaaaaa");
  printf("aaaaaaaaaa");

  // 下面的代码是新增的
  printf("aaaaaaaaaaaa");
  printf("aaaaaaaaaaaa");
  printf("aaaaaaaaaaaa");
  printf("aaaaaaaaaaaa");
  printf("aaaaaaaaaaaa");
  return 0;
}
